package api

import (
	"api_online/config"
	"api_online/data"
	"api_online/response"
	"net/http"
)

// 表单请求页面
func Request(w http.ResponseWriter, r *http.Request) {
	url := r.URL.Query().Get("url")

	apiInfo := data.Cache.GetApiInfoByUrl(url)
	apiInfo.UrlFull = config.Config.GetUrl() + apiInfo.Url

	param := apiInfo.Param
	for k, v := range param {
		v.DefaultCache = data.Cache.GetParamKeyByUrl(apiInfo.Url, v.Key)
		param[k] = v
	}

	res, _ := response.SuccessRes(apiInfo)
	w.Write(res)
}
